package com.xidian.zhiancloud.controller.accidentManage;

import com.xidian.zhiancloud.controller.base.BaseController;
import com.xidian.zhiancloud.dto.ResultDTO;
import com.xidian.zhiancloud.enums.GeneralResponseEnums;
import com.xidian.zhiancloud.service.accidentManage.MissAccidentStatisticService;
import com.xidian.zhiancloud.vo.accidentmessage.MissAccidentStatisticVO;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName MissAccidentStatisticController
 * @Description 未遂事件统计图表接口
 * @Author Halo
 **/
@RestController
@RequestMapping("/missAccidentStatistic")
public class MissAccidentStatisticController extends BaseController {

    @Resource
    private MissAccidentStatisticService missAccidentStatisticService;

    /**
     * 根据未遂事件发生的主要原因进行统计
     * @return 返回查询结果 List<MissAccidentStatisticVO>类型
     */
    @RequestMapping("/statisticByMainCuase")
    public ResultDTO<List<MissAccidentStatisticVO>> statisticByMainCuase(){
        return ResultDTO.successOf(missAccidentStatisticService.statisticByMainCuase(getSessionUserCompanyId()),
                GeneralResponseEnums.SUCCESS);
    }

    /**
     * 根据未遂事件的责任部门进行统计
     * @return 返回查询结果 List<MissAccidentStatisticVO>类型
     */
    @RequestMapping("/statisticByDepartment")
    public ResultDTO<List<MissAccidentStatisticVO>> statisticByDepartment(){
        return ResultDTO.successOf(missAccidentStatisticService.statisticByDepartment(getSessionUserCompanyId()),
                GeneralResponseEnums.SUCCESS);
    }

}
